<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://unpkg.com/jquery@3.6.0/dist/jquery.js"></script> -->
    <script src="./i18n/jquery.min.js"></script>
    <script src="./i18n/jquery.i18n.properties.js"></script>
    <script src="./i18n/language.js"></script>
    <script>
        // dom not ready
        console.log(document.getElementsByTagName('input'))
        let input_arr = document.getElementsByTagName('input')
        for (let index = 0; index < input_arr.length; index++) {
            const element = input_arr[index];
            console.log(element)
        }
        Array.from(document.getElementsByTagName('input')).forEach(element => {
            console.log(element)
        });
        // dom not foreach
        // document.getElementsByTagName('input').forEach(element => {
        // console.log(element)
        // });
        // dom ready
        $(function () {
            console.log($);
            console.log($.i18n);

            /* js获取文本 */
            console.log(i18nProp("c_1"))
            // dom ready foreach
            let input_arr = document.getElementsByTagName('input')
            for (let index = 0; index < input_arr.length; index++) {
                const element = input_arr[index];
                console.log(element)
            }
        })
    </script>
</head>

<body>
    <div>
        <!-- 普通文本 -->
        <span i18n="c_1">1</span><br>
        <!-- value值 -->
        <input type="text" i18n-v="c_2"><br>
        <!-- placeholder属性 -->
        <input type="text" i18n-p="c_3"><br>
        <span>i18nProp('c_1')</span> 失败, 只可以标签内事件引用js对象,带引号 <br>
        <input type="button" name="" id="1" value="i18nProp('c_1')"> 失败<br>
        <input type="button" name="" id="1" i18n-v="c_1"> 可以,js会处理<br>
        <input type="text" name="" id="2" onclick="alert(i18nProp('c_1'))">
        <!-- 动态切换不同语言 -->
        <button onclick="i18nExecute('en_US')">切换语言</button>
    </div>
</body>

</html>